<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
  <head>
    <link href="css/style.css" type="text/css" rel="stylesheet">
    <script type="text/javascript" src="bin/prototype.js"></script>
    <script type="text/javascript" src="bin/functions.js"></script>
    <script type="text/javascript" src="bin/library.js"></script>


    <title> LYON UNO </title>
  </head>

  <body>

    <div id="head_pic">
      <img src="images/title.png" alt="[LYON UNO]" id="picture">
    </div>

    <div id="webpage">

<p>Here you can create a new game</p>
<hr>
<form method="POST" action="create.php" onsubmit="return validate_create(this)" name="formul_profile">
<table>
<tr>
	<td>	Name for the game	</td>
	<td>	<input type="text" maxlength="50" size="20" name="nameG" /> <span id="errorName"></span>	</td>
</tr>
<tr>
	<td> Do you want to create a private game? </td>
	<td> <input type="checkbox" name="privateG"> Yes, please </td>
</tr>
<tr>
	<td> <hr><b> Private games fields</b> <hr> </td><td></td>
</tr>
<tr>
	<td>	A message for your friends	</td>
	<td>	<input type="text" maxlength="50" size="20" name="messG" />	</td>
</tr>
<?php
$hostDB = "localhost";
$userDB = "ampersand";
$passDB = "palomitas";
$dbnameDB = "LYONUNO";

$canalDB = mysql_connect($hostDB, $userDB, $passDB);
$db = mysql_select_db($dbnameDB);
$user = $_COOKIE["loggedIn"];
$consulta = 'select nick from USERS where nick <>\''.$user.'\' order by nick asc';

$resDB = mysql_db_query($dbnameDB, $consulta,$canalDB);

echo "<tr> <td> Invited player 1 </td>\n";
echo "<td> <select name=\"player1G\">\n";
while($row = mysql_fetch_object($resDB)){
	$nick = $row->nick;
	echo "<option VALUE=\"$nick\">$nick</OPTION>\n";
}
echo "</select> <span id=\"errorPlayer\"></span> </td></tr>\n";

mysql_free_result($resDB);

$resDB = mysql_db_query($dbnameDB, $consulta,$canalDB);

echo "<tr> <td> Invited player 2 </td>\n";
echo "<td> <select name=\"player2G\">\n";
while($row = mysql_fetch_object($resDB)){
	$nick = $row->nick;
	echo "<option VALUE=\"$nick\">$nick</OPTION>\n";
}
echo "</select></td></tr>\n";

mysql_free_result($resDB);

$resDB = mysql_db_query($dbnameDB, $consulta,$canalDB);

echo "<tr> <td> Invited player 3 </td>\n";
echo "<td> <select name=\"player3G\">\n";
while($row = mysql_fetch_object($resDB)){
	$nick = $row->nick;
	echo "<option VALUE=\"$nick\">$nick</OPTION>\n";
}
echo "</select></td></tr>\n";

mysql_free_result($resDB);
mysql_close($canalDB);

?>
</table>
<input type="submit" value="Create"/>
</form>
<br>
<a href="main.php"> Back to the main page</a>
    </div>

    <div id="foot">
      <address>LYON UNO. CPE <br> 43, boulevard du 11 Novembre 1918. BP 2077 <br> 69616 Villeurbanne Cedex </address>
    </div>
  </body>
</html>

